<html>
<head>
  <title>a2_sample3.php</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;PHP Demo A2.3&lt;/title&gt;
 &lt;/head&gt;

&lt;body&gt;

&lt;h1&gt;Demo A2.3&lt;/h1&gt;

&lt;p&gt;


&lt;?php

//  phpinfo();

  echo &quot;&lt;p&gt;&quot; . `/bin/date` . &quot;&lt;p&gt;&quot;;

// import the PHP code that make it so easy to access the remote server
  require('HttpClient.class.php');

// create a &quot;client&quot; object which will access the desired web site
  $client = new HttpClient('media.jcu.edu.au');

// leave debug off UNLESS you have problems
  $client-&gt;setDebug(false);

// grab a news item
  if ( ! $client-&gt;get('/story.cfm?id=777 ') ) {
    die( 'An error occurred: ' . $client-&gt;getError() );
  }

// copy the web page contents into $pageContents and display
  $pageContents = $client-&gt;getContent();

echo '&lt;p&gt; Here is a raw dump of the same HTML.

&lt;hr&gt;

&lt;pre&gt;
';
  print str_replace( '&lt;', '&amp;lt;', $pageContents );
  echo '&lt;/pre&gt;';

?&gt;
 
&lt;p&gt;

&lt;hr&gt;

&lt;/body&gt;
&lt;/html&gt;

</pre>
<hr>
syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
</body>
</html>
